package com.reportes;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.servlet.http.HttpServletRequest;

import com.Reporte;

import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRResultSetDataSource;
import exceptions.InvalidArgumentException;

public class Tipo_cambio extends Reporte {

	@Override
	public void VerificarParametros(HttpServletRequest request)
			throws InvalidArgumentException {

		setParametrosJasper("parametro",request.getParameter("parametroConsulta"));
	}

	@Override
	public Object clone() throws CloneNotSupportedException {
		Tipo_cambio reporte = new Tipo_cambio();
		copyAttributesTo(reporte);
		return reporte;
	}

	@Override
	protected JRDataSource executeQuery(Connection connection)
			throws SQLException {
		StringBuffer sql =
			new StringBuffer("SELECT *")
					.append(" FROM")
					.append(" Tipo_cambio")
					.append(" ORDER BY id");
		Statement statement = connection.createStatement();
		ResultSet rs = statement.executeQuery(sql.toString());
		return new JRResultSetDataSource(rs);
	}

}
